# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-coverage
pkgver=7.5.1
pkgrel=0
pkgdesc="Code coverage measurement for Python"
options="!check" # Requires 'xdist'
url="https://pypi.org/project/coverage"
arch="all"
license="Apache-2.0"
makedepends="python3-dev py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/c/coverage/coverage-$pkgver.tar.gz"
builddir="$srcdir/coverage-$pkgver"

replaces="py-coverage" # Backwards compatibility
provides="py-coverage=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel --wheel-dir .dist --output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
db9fe405c52e30e2aa673caf0cc8a02b5f62fd53b969003d231b52cf9463afc22924d5c29859447d6139be9c6642036f3cbc690ae4055d250a73c9dcd1f805a2  coverage-7.5.1.tar.gz
"
